home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / CALib & You… / Documentation / CALib Document API's < prev    next >
Encoding:
Text File  |  1995-12-15  |  7.1 KB  |  178 lines  |  [TEXT/ttxt]

  1. CALib Documents & Storage API’s
  2. By The OpenDoc™ Engineering Team
  3. December 15, 1995
  4.  
  5.  
  6. © 1993-1995  Apple Computer, Inc. All Rights Reserved.
  7. Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
  8. Mac and OpenDoc are trademarks of Apple Computer, Inc.
  9. ----------------------------------------------------------------------------------------------------------------------------
  10.  
  11.  
  12.  
  13. CADocument
  14.  
  15. A CALib document (CADocumentRef) represents an OpenDoc™ Container 'odcn'.  A  CADocument may refer to a proxy part document, an OpenDoc part document, the clipboard document or the drag&drop document.
  16.  
  17. A CADocument can be the target of clone operations (CADataX.cpp), stream I/O operations (CAStream.cpp), and display operations.  
  18.  
  19. A CADocument can be saved as either a flattened container stream or as an OpenDoc container file.
  20. For container streams, the stream can be saved to a file or to a memory buffer.
  21.  
  22. For each open CADocument, CALib maintains an ODContainer object.  For CALib savvy CA’s,
  23. the ODContainer maintained by CALib is instantiated directly from the CA’s document file (as opposed to CALib maintaining a separate temporary file for the container.
  24.  
  25.  
  26.  
  27. CADocument Types
  28.  
  29. Proxy Document - Proxy documents are created and managed by the CA to allow embedding in application documents.  Proxy documents may also may be used as temporary documents for data transfer.
  30.  
  31. OpenDoc Part Documents - used for documents dragged in from theFinder and for the Insert… menu.  Obtained from CAOpenDocument(), opened read-only, in place (no temporary container is maintained).
  32.  
  33. Clipboard Document - obtained from CAGetClipboardDocument()
  34.  
  35. Drag&Drop Document - obtained from CAGetDragDropDocument()
  36.  
  37.  
  38.  
  39.  
  40. CADocument API
  41.  
  42. pascal    void CACreateDocument(
  43. FSSpecPtr                    docSpec,
  44. Handle                        docHandle );
  45.  
  46. docSpec        -    If docSpec is non-NULL, a file container is created.
  47. docHandle        -    If docHandle is non-NULL, a memory container is created.
  48.  
  49. If docSpec  & docHandle  are both NULL, CALib creates a temporary file which contains the working container (The container is then streamed to a CA document file or saved in place, using CASaveDocument).
  50.  
  51. pascal    void CASaveDocument(
  52. CADocumentRef    document, 
  53. CAOffset            offset,
  54. CASize*            length,
  55. FSSpecPtr            docFile,
  56. Handle*            docHandle );
  57.  
  58. document    -    is the CADocument to be saved.
  59.  
  60. docFile        -    is the file for which an OpenDoc container document is created or     the file where the container stream is written.  If docFile  is NULL (and docHandle is NULL) then the working container referred to by document  is saved in place. 
  61.             
  62. docHandle    -    is the buffer where the container stream is written (if docFile == NULL).   If docHandle  is  NULL then the working container referred to by document  is saved in place.
  63.  
  64. offset        -    is the offset into docFile or docHandle where the container stream is written.
  65.  
  66. length        -    length = 0 means to save document as an OpenDoc container file.  If    length != 0, it is an out parameter which receives the total length of the container stream.
  67.  
  68.  
  69. Usage Matrix
  70.  
  71. Doc Type        Target                                                                                                    Offset            Length                                Action
  72.  
  73. Proxy                                 docFile                                                                                                0                                                    NULL                                                    Rename temp ctr file, save in place
  74. Proxy                                    docFile                                                                                                0                                                    non-NULL                Rename temp ctr file, save in place
  75. Proxy                                    docHandle                                                                    0                                                    NULL                                                    N/A
  76. Proxy                                    docHandle                                                                    0                                                    non-NULL                save temp mem container to docHandle
  77. Proxy                                    docFile                                                                                                non-0                non-NULL                stream temp ctr file to docFile at offset
  78. Proxy                                    docHandle                                                                    non-0                non-NULL                stream temp ctr file to docHandle at offset
  79. Proxy                                    docFile = tempFile        0                                                        NULL                                                    save in temp file container in place
  80. Proxy                                    docFile = tempFile        non-0                    NULL                                                Illegal input
  81. Proxy                                        both NULL                                                                0                                                        NULL                                                    save temp file container in place
  82. Proxy                                        both NULL                                                                non-0                    non-NULL                Illegal input
  83. Proxy                                        both non-NULL                            n/a                                        n/a                                                                    Illegal input
  84.  
  85.  
  86. pascal    CADocumentRef CAOpenDocument(
  87. CAOffset            offset,
  88. CASize*            length,
  89. FSSpecPtr            docFile,
  90. Handle                docHandle );
  91.  
  92. docFile        -    If docFile  is non-NULL it specifies the location of OpenDoc container.  The container
  93.                 is either embedded within the file (if offset != 0), or docFile  specifies an
  94.                 OpenDoc container file (CALib savvy).
  95.             
  96. docHandle    -    If docHandle  is non-NULL it specifies the location of an OpenDoc container.  The
  97.                 container is either embedded within the memory refered to by docHandle  (if offset != 0), 
  98.                 or docHandle  specifies an OpenDoc memory container (CALib savvy).
  99.  
  100. offset        -    is the offset into newFile or docHandle where the container stream is written.
  101.  
  102. length        -    length ==0 indicates the target file is an OpenDoc container file.    
  103.  
  104.  
  105. Target                                                                                                        Offset            Action
  106.  
  107. docFile                                                                                                    0                                                        docFile is an OpenDoc ctr file, opened in place
  108.                                                                                                                                                                                                                                             may be a CA doc file or a OpenDoc part document file.
  109. docHandle                                                                    0                                                    docHandle is a memory ctr, opened in place
  110. docFile                                                                                                    non-0            docFile contains a stream out ctr, temp file created.
  111. docHandle                                                                    non-0            docHandle contains a stream out ctr, temp file created.
  112. both NULL                                                                    n/a                                        Illegal
  113. docFile & docHandle    n/a                Illegal input
  114.  
  115.  
  116.  
  117. Clone API
  118.  
  119. The clone API is used by CA's for all types of data transfer.  The clone API is the only means by which a CA can introduce or remove embedded frames to/from documents.
  120.  
  121. CABeginClone() - See CALib API specification
  122. CAEndClone() - See CALib API specification
  123. CARemoveFrameRef()  - See CALib API specification
  124.  
  125. pascal    CAFrameRef    CACloneFrameRef(     CAFrameRef        sourceFrameRef,    
  126.                                             CADocumentRef    sourceDocument,
  127.                                             CADocumentRef    destDocument,
  128.                                             Boolean        isRootFrameRef,
  129.                                             CACloneKey        cloneKey);
  130.  
  131. sourceFrameRef     -    specifies the frame being cloned.  NULL if cloning the root part of a CADocument.
  132. sourceDocument     -    specifies the CADocument in which sourceFrameRef is contained, or sourceFrameRef  == NULL
  133. destDocument  - specifies the CADocument where the framed will be cloned to.
  134. isRootFrameRef  - TRUE if cloning a single embedded frames
  135. cloneKey  - cloneKey returned from CABeginClone()
  136.  
  137.  
  138.  
  139. Stream API
  140.  
  141. The stream API  can be used by CA's to access the content value stream(s) associated with each CADocument.
  142.  
  143. See CALib API specification for descriptions of the following.
  144.  
  145. CARead()
  146. CAWrite()
  147. CAGetSize( )
  148. CAGetOffset()
  149. CASetOffset()
  150. CAInsert()
  151. CADelete()
  152.  
  153.  
  154. Kind API
  155.  
  156. Single Kind 
  157.  
  158. For CA's which need only support a single content value stream, the CASetDocumentKind() and CAGetDocumentKind()
  159. routines can be used.
  160.  
  161.  
  162. Multiple Kind
  163.  
  164. For CA's which require multiple content value streams, the following methods can be used.  Multiple value streams are required for data transfer supporting multiple flavor types.
  165.  
  166.  
  167. See CALib API specification for descriptions of the following.
  168.  
  169. CAUseKind()
  170. CACurrentKind()
  171. CAAddKind()
  172. CARemoveKind()
  173. CAGetNthKind()
  174. CAGetKindCount()
  175.  
  176.  
  177.  
  178.